<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/11 0011
  Time: 20:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fnt" uri="http://java.sun.com/jsp/jstl/functions" %>
<div class="page-container">
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th>考试信息</th>
                <th>用户账号</th>
                <th>性别</th>
                <th>真实姓名</th>
                <th>学历</th>
                <th>岗位</th>
                <th>联系方式</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${participantsList}" var="participants" varStatus="stat">
                <tr class="text-c" style="text-align: center;">
                    <td class="text-l">
                        <a class="user-message">
                            ${fnt:substring(participants.examination.examinationTitle,0 ,10 )}
                            ${fnt:length(participants.examination.examinationTitle) gt 10?'...':''}
                        </a>
                    </td>
                    <input type="hidden" value="<f:formatDate value="${participants.examination.examinationStartTime}" pattern="yyyy-MM-dd HH:mm:ss"></f:formatDate>">
                    <input type="hidden" value="<f:formatDate value="${participants.examination.examinationEndTime}" pattern="yyyy-MM-dd HH:mm:ss"></f:formatDate>">
                    <td>${participants.userInfo.email}</td>
                    <td>${participants.userInfo.sex}</td>
                    <td>${participants.userInfo.userName}</td>
                    <td>${participants.userInfo.education.educationName}</td>
                    <td>${participants.userInfo.post.postName}</td>
                    <td>${participants.userInfo.phone}</td>
                    <td class="f-14 td-manage">
                        <a style="text-decoration:none" class="ml-5" onClick="article_del(this,'${participants.id}')" href="javascript:;" title="删除">
                            <i class="Hui-iconfont">&#xe631;</i>
                        </a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/manage/js/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/manage/js/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/manage/js/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/manage/js/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    //鼠标上去，显示全部信息
    $(".user-message").click(function () {
        var title=$(this).html();
        var startTime=$(this).parent().next().val();
        var endTime=$(this).parent().next().next().val();
        layer.open({
            type: 1,
            area: ['500px'],
            fix: false, //不固定
            maxmin: true,
            shade:0.4,
            title: '查看考试具体详情信息',
            content: '<p>考试标题:'+title+'</p>' +
                '<p>考试开始时间:'+startTime+'</p>'+
                '<p>考试截止时间:'+endTime+'</p>'
        });
    });
    $(function(){
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
            ]
        });

    });
    /*用户-删除*/
    function article_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            var data={id:id};
            $.ajax({
                type: 'get',
                url: '/manage/examination/updateParticipants',
                data:data,
                success: function(data){
                    $(obj).parents("tr").remove();
                    layer.msg('已删除!',{icon:1,time:1000});
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
</script>